package com.erlang.spring.controller;

import com.erlang.spring.service.AccountService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *  @Description: 调用层
 *
 */
public class ClientController {


  /**
   * ApplicationContext:spring-IOC容器
   * ClassPathXmlApplicationContext：容器实现类，加载配置文件
   * applicationContext.getBean：获得容器中的bean对象
   */
  @Test
  public  void  createAccountTest(){
    //加载bean.xml
    ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:bean.xml");
    //获取accountDao accountDao实例化的bean
    AccountService accountService = (AccountService) applicationContext.getBean("accountService");
    //执行
    accountService.createAccount();
  }
}
